{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "07e1b4c7",
   "metadata": {},
   "source": [
    "## 1.web最小的应用"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "57aee993",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " * Serving Flask app '__main__'\n",
      " * Debug mode: off\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.\n",
      " * Running on http://127.0.0.1:5000\n",
      "Press CTRL+C to quit\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:30] \"GET / HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:30] \"GET /assets/css/ie10-viewport-bug-workaround.css HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:30] \"GET /assets/js/ie-emulation-modes-warning.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:30] \"GET /dist/js/bootstrap.min.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:30] \"GET /assets/js/ie10-viewport-bug-workaround.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:30] \"GET /favicon.ico HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:34] \"GET /colourapp HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:34] \"GET /assets/css/ie10-viewport-bug-workaround.css HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:34] \"GET /assets/js/ie-emulation-modes-warning.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:34] \"GET /assets/js/ie10-viewport-bug-workaround.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:34] \"GET /dist/js/bootstrap.min.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:44] \"POST /results HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:44] \"GET /assets/css/ie10-viewport-bug-workaround.css HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:44] \"GET /assets/js/ie-emulation-modes-warning.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:44] \"GET /dist/js/bootstrap.min.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:27:44] \"GET /assets/js/ie10-viewport-bug-workaround.js HTTP/1.1\" 404 -\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "#b19191\n",
      "#dd6e6e\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "127.0.0.1 - - [02/Jan/2024 21:28:21] \"GET /introduction HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:21] \"GET /assets/css/ie10-viewport-bug-workaround.css HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:21] \"GET /assets/js/ie-emulation-modes-warning.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:21] \"GET /dist/js/bootstrap.min.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:21] \"GET /assets/js/ie10-viewport-bug-workaround.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:51] \"GET /contact HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:51] \"GET /assets/css/ie10-viewport-bug-workaround.css HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:51] \"GET /assets/js/ie-emulation-modes-warning.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:51] \"GET /dist/js/bootstrap.min.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:51] \"GET /assets/js/ie10-viewport-bug-workaround.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:53] \"GET /introduction HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:53] \"GET /assets/css/ie10-viewport-bug-workaround.css HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:53] \"GET /assets/js/ie-emulation-modes-warning.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:53] \"GET /dist/js/bootstrap.min.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:28:53] \"GET /assets/js/ie10-viewport-bug-workaround.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:34:01] \"GET /contact HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:34:01] \"GET /dist/js/bootstrap.min.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:34:01] \"GET /assets/css/ie10-viewport-bug-workaround.css HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:34:01] \"GET /assets/js/ie-emulation-modes-warning.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:34:01] \"GET /assets/js/ie10-viewport-bug-workaround.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:34:07] \"GET /introduction HTTP/1.1\" 200 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:34:07] \"GET /dist/js/bootstrap.min.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:34:07] \"GET /assets/css/ie10-viewport-bug-workaround.css HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:34:07] \"GET /assets/js/ie-emulation-modes-warning.js HTTP/1.1\" 404 -\n",
      "127.0.0.1 - - [02/Jan/2024 21:34:07] \"GET /assets/js/ie10-viewport-bug-workaround.js HTTP/1.1\" 404 -\n"
     ]
    }
   ],
   "source": [
    "from flask import Flask\n",
    "from flask import render_template,request\n",
    "app = Flask(__name__)\n",
    "\n",
    "@app.route('/')\n",
    "def index():\n",
    "    return render_template('index.html')\n",
    "\n",
    "@app.route('/introduction')\n",
    "def introduction():\n",
    "    return render_template('introduction.html')\n",
    "\n",
    "@app.route('/contact')\n",
    "def contact():\n",
    "    return render_template('contact.html')\n",
    "\n",
    "@app.route('/colourapp')\n",
    "def colourapp():\n",
    "    return render_template('app.html')\n",
    "\n",
    "@app.route('/results',methods=[\"POST\"])\n",
    "def results():\n",
    "    print(request.form['selectcolor_up'])\n",
    "    print(request.form['selectcolor_down'])\n",
    "    return render_template('app.html',\n",
    "                          user_choose_color_up = request.form['selectcolor_up'],\n",
    "                          user_choose_color_down = request.form['selectcolor_down']\n",
    "                          )\n",
    "\n",
    "\n",
    "app.run()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "52c9eec8",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3c1b98a8",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "65a3fb82",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
